package com.ymatou.apigateway.parameter.resp;

public enum ResultCode {
	/******************************* 公共返回码 *************************************************/

	SUCCESS("0000", "成功"),

	INVALID_PARAM("0001", "参数错误"),

	INVALID_AUTH_CODE("0002", "非法授权码"),

	INVALID_REQ_TIME("0003", "非法请求时间"),

	SIGN_VERIFY_FAIL("0004", "验签失败"),

	INVALID_API_NAME("0005", "非法api名称"),

	BIZ_PARAM_JSON_FORMAT_ERR("0006", "业务请求参数JSON格式不正确!"),

	ERROR("0009", "处理失败,请稍后重试"),

	/******************************* 公共返回码 *************************************************/

	/******************************* 各业务返回码 *************************************************/

	;

	String code;
	String message;

	ResultCode(String code, String message) {
		this.code = code;
		this.message = message;
	}

	public String getCode() {
		return code;
	}

	public String getMessage() {
		return message;
	}

	public static ResultCode findByCode(String code) {
		for (ResultCode resultCode : ResultCode.values()) {
			if (resultCode.getCode().equals(code)) {
				return resultCode;
			}
		}
		return ResultCode.ERROR;
	}
}
